package com.game.sdk.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/***
 * 有些地方可能需要用到时间的工具类，这里加上，以防后面代码累赘
 * 
 * @author ling
 * @date 2016/6
 * */
public class DateUtil {
	private static DateUtil instance = null;

	private DateUtil() {
	}

	public static synchronized DateUtil newInstance() {
		if (instance == null) {
			instance = new DateUtil();
		}
		return instance;
	}

	public String getCurrentDateFormat(String partten) {
		long curr = System.currentTimeMillis();
		SimpleDateFormat format = new SimpleDateFormat(partten);
		return format.format(new Date(curr));
	}
	
	public String getCurrentDateFormatDefult() {
		long curr = System.currentTimeMillis();
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		return format.format(new Date(curr));
	}
	public String getCurrentDateFormatDefult(long time) {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		return format.format(new Date(time));
	}
	public String getCurrentDateFormatDefult(long time,String partten) {
		SimpleDateFormat format = new SimpleDateFormat(partten);
		return format.format(new Date(time));
	}
	
	
}
